package com.ssyx.order.feign;

import com.ssyx.model.activity.CouponInfo;
import com.ssyx.model.order.CartInfo;
import com.ssyx.vo.order.CartInfoVo;
import com.ssyx.vo.order.OrderConfirmVo;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

import java.util.List;

/**
 * ClassName:ActivityFeignClient
 * Description:
 *
 * @Author kay
 * @Create 2024/5/22 9:47
 * @Version 1.0
 */
@FeignClient(value = "service-activity")
public interface ActivityFeignClient {

    //获取购物车满足条件的促销与优惠券信息
    @PostMapping("/api/activity/inner/findCartActivityAndCoupon/{userId}")
    OrderConfirmVo findCartActivityAndCoupon(@RequestBody List<CartInfo> cartInfoList,
                                             @PathVariable("userId") Long userId);

    //根据购物车列表,获取相关优惠活动信息 封装在CartInfoVo中
    @PostMapping("/api/activity/inner/findCartActivityList")
    List<CartInfoVo> findCartActivityList(@RequestBody List<CartInfo> cartInfoList);

    //根据购物车列表,以及用户的优惠券id,得到购物车商品使用优惠券的相关规则信息
    @PostMapping("/api/activity/inner/findRangeSkuIdList/{couponId}")
    CouponInfo findRangeSkuIdList(@RequestBody List<CartInfo> cartInfoList,
                                         @PathVariable Long couponId);

    //订单生成之后,修改优惠券使用状态
    @GetMapping("/api/activity/inner/updateCouponInfoUseStatus/{couponId}/{orderId}/{userId}")
    void updateCouponInfoUseStatus(@PathVariable Long couponId,
                                   @PathVariable Long orderId,
                                   @PathVariable Long userId);
}
